package com.lagou.rpc.zookeeper.config;

/**
 * zookeeper全局配置类
 */
public class ConfigKeeper {
    private static volatile ConfigKeeper configKeeper;
    // netty服务端的端口号
    private int port;
    // zookeeper地址
    private String connectString;
    // 主动上报间隔时间，单位:秒
    private int interval;
    // 客户端侧
    private boolean consumerSide;
    // 服务端侧
    private boolean providerSide;

    private ConfigKeeper(){
    }

    //单例模式--创建一个全局单例的zookeeper配置类对象
    public static ConfigKeeper getInstance(){
        if (null==configKeeper){
            synchronized (ConfigKeeper.class){
                configKeeper = new ConfigKeeper();
            }
        }
        return configKeeper;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getConnectString() {
        return connectString;
    }

    public void setConnectString(String connectString) {
        this.connectString = connectString;
    }

    public int getInterval() {
        return interval;
    }

    public void setInterval(int interval) {
        this.interval = interval;
    }

    public boolean isConsumerSide() {
        return consumerSide;
    }

    public void setConsumerSide(boolean consumerSide) {
        this.consumerSide = consumerSide;
    }

    public boolean isProviderSide() {
        return providerSide;
    }

    public void setProviderSide(boolean providerSide) {
        this.providerSide = providerSide;
    }
}
